﻿CREATE TABLE LJDEEXTTRT 
(
  UNIQUE_NUMBER   NUMBER(18),
  TRAN_KEY        VARCHAR2(10 BYTE),
  TRCOCO          VARCHAR2(2 BYTE),
  TRTENA          VARCHAR2(2 BYTE),
  TRTENU          NUMBER(2),
  TRTRSD          NUMBER(8),
  TRTRST          NUMBER(6),
  TRTRSE          NUMBER(3),
  TRDICO          VARCHAR2(5 BYTE),
  TRBANU          VARCHAR2(7 BYTE),
  TRTRNA          VARCHAR2(4 BYTE),
  TRINIT          VARCHAR2(10 BYTE),
  TRRECO          VARCHAR2(2 BYTE),
  TRMESS          VARCHAR2(458 BYTE),
  PROCESS_STATUS  VARCHAR2(1 BYTE),
  ERROR_MSG       VARCHAR2(50 BYTE),
  DATA_TIME       TIMESTAMP(6),
  SUB_SYS         VARCHAR2(4 BYTE),
  BATCH_NUMBER    NUMBER(6)
);

CREATE UNIQUE INDEX PK_LJDEEXTTRT ON LJDEEXTTRT (UNIQUE_NUMBER);

ALTER TABLE LJDEEXTTRT ADD (
  CONSTRAINT PK_LJDEEXTTRT
  PRIMARY KEY (UNIQUE_NUMBER)
  USING INDEX PK_LJDEEXTTRT); 
  
CREATE SEQUENCE SEQ_LJDEEXTTRT
  START WITH 1000000
  MAXVALUE 99999999999999999999
  MINVALUE 1000000
  NOCYCLE
  NOCACHE
  NOORDER;
  
CREATE OR REPLACE TRIGGER "TR_LJDEEXTTRT" BEFORE INSERT ON LJDEEXTTRT FOR EACH ROW
DECLARE
       V_PKVALUE  NUMBER;
     BEGIN
        SELECT SEQ_LJDEEXTTRT.NEXTVAL INTO V_PKVALUE FROM DUAL;
         :NEW.UNIQUE_NUMBER := V_PKVALUE;
   END TR_LJDEEXTTRT;